package com.zb.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zb.dto.QuotaAllInfo;
import com.zb.entity.TbAlarmModel;
import com.zb.service.TbAlarmService;
import com.zb.util.Pager;
import com.zb.util.ResultResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName TbAlarmController
 * @Description 控制器
 * @Author xm
 * @Date 2025/03/26 11:23
 **/
@RestController
@RequestMapping("/tb-alarm-model")
@Api(value = "TbAlarmController", tags = {"控制器"})
public class TbAlarmController {
	@Autowired
	public TbAlarmService tbAlarmModelService;

	@GetMapping(value = "/query-alaram")
	@ApiOperation(value = "报警日志查询")
	public ResultResponse queryAlarmToInflux(@RequestParam(value = "page",defaultValue = "1",required = false) Long page,
											 @RequestParam(value = "pageSize",defaultValue = "2",required = false) Long pageSize,
                                             @RequestParam(value = "start",required = false) String start,
                                             @RequestParam(value = "end",required = false) String end,
                                             @RequestParam(value = "alarmName",required = false) String alarmName,
                                             @RequestParam(value = "deviceId",required = false) String deviceId){
		Pager<QuotaAllInfo> infoPager = tbAlarmModelService.queryAlarmToInflux(page,pageSize,
				start,end,alarmName,deviceId);
		return ResultResponse.success(infoPager);

	}
}
